package com.itheima.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <h1>minioConfig配置类</h1>
 *
 * @author <a href="11n_yd2h5e1jx8@dingtalk.com">叶世铭</a>
 * @since 2024/1/3
 */
@Configuration
@ConfigurationProperties(prefix = "minio")
@Data
public class MinioConfig {

    private String ip;

    private Integer port;

    private String accessKey;

    private String secretKey;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(ip, port, false)
                .credentials(accessKey, secretKey)
                .build();
    }
}
